package 代码记录.校招笔试真题.笔试真题_2023.北京360;

import java.util.Scanner;

/**
 * @author zx
 * @create 2023-03-18 15:23
 * 27%
 */
public class Test2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        sc.nextLine();
        int[][] arr = new int[n][3];
        int[] lie = new int[m];
        for(int i = 0;i < n;i++){
            for(int j = 0;j < 3;j++){
                arr[i][j] = sc.nextInt();
            }
        }
        for(int i = 0;i < m;i++){
            lie[i] = sc.nextInt();
        }
        long[] A = new long[10000];
        for(int i = 0;i < n;i++){
            int l = arr[i][0];
            int r = arr[i][1];
            int x = arr[i][2];
            for(int j = l;j <= r;j++){
                A[j] = A[j] ^ x;
            }
        }
        for(int i = 0;i < m;i++){
            System.out.println(A[lie[i]]);
        }
    }
}
